<?php

    function prettyDump(array $arr, $pre = true) {
        if ($pre) echo '<pre>';
        echo 'Array (<br />';
        foreach ($arr as $key => $value) {
            if (is_array($value)) {
                prettyDump($value, false);
            } else {
                echo '    '.$key." => ".$value."<br />";
            }
        }
        echo ')<br />';
        if ($pre) echo '</pre>';
    }

    $numbers = range(1,10);

    $arr = array();

    $arr['name'] = 'json';
    $arr['age'] = 23;
    $arr['collage'] = 'njau';

    list($item) = each($arr);
    reset($arr);

    $products = array( array('TIR', 'Tires', 100),
                       array('OIL', 'Oil', 10),
                       array('SPK', 'Spark Plug', 4));

    $pictures = array('tire.jpg', 'oil.jpg', 'spark_plug.jpg', 'door.jpg',
                      'steering_wheel.jpg', 'thermostat.jpg', 'wiper_blade.jpg',
                      'gasket.jpg', 'brake_pad.jpg');

    prettyDump($pictures);
    shuffle($pictures);
    prettyDump($pictures);
    $reversePictures = array_reverse($pictures);
    prettyDump($reversePictures);
